import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

public class Solution {
    public int firstUnqichar(String s) {
        Set<Integer> set = new HashSet<>();
        return 0;
    }
    public int singleNumber(int[] nums) {
        Set<Integer> set = new TreeSet<>();
        for(int i = 0; i < nums.length; i++) {
            if(set.contains(nums[i])) {
                set.remove(nums[i]);
            } else {
                set.add(nums[i]);
            }
        }
        int val = 0;
        for(int i = 0; i < nums.length; i++) {
            if(set.contains(nums[i])) {
                val = nums[i];
            }
        }
        return val;
    }
}
